From ceb9b863594a74b81b4907e6dace10bafc319891 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Tue, 2 Jan 2007 23:37:56 +0000 Subject: [PATCH] (bug 8461) Support watching pages on move --- RELEASE-NOTES | 1 + includes/SpecialMovepage.php | 20 ++++++++++++++++++++ includes/SpecialPreferences.php | 2 +- includes/User.php | 1 + languages/messages/MessagesEn.php | 2 ++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6dbf0647fe..3134ce8f02 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -452,6 +452,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Avoid PHP warning in Creative Commons metadata when a creative commons license is not actually set up * (bug 8463) Don't print external link icons for Monobook +* (bug 8461) Support watching pages on move == Languages updated == diff --git a/includes/SpecialMovepage.php b/includes/SpecialMovepage.php index 6701c083d3..e3112c4c06 100644 --- a/includes/SpecialMovepage.php +++ b/includes/SpecialMovepage.php @@ -49,6 +49,8 @@ function wfSpecialMovepage( $par = null ) { class MovePageForm { var $oldTitle, $newTitle, $reason; # Text input var $moveTalk, $deleteAndMove; + + private $watch = false; function MovePageForm( $par ) { global $wgRequest; @@ -62,6 +64,7 @@ class MovePageForm { $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', true ); } $this->deleteAndMove = $wgRequest->getBool( 'wpDeleteAndMove' ) && $wgRequest->getBool( 'wpConfirm' ); + $this->watch = $wgRequest->getCheck( 'wpWatch' ); } function showForm( $err ) { @@ -171,6 +174,14 @@ class MovePageForm { " ); } + + $watchChecked = $this->watch || $wgUser->getBoolOption( 'watchmoves' ) || $ot->userIsWatching(); + $watch = ''; + $watch .= '' . Xml::check( 'wpWatch', $watchChecked, array( 'id' => 'watch' ) ) . ''; + $watch .= '' . Xml::label( wfMsg( 'move-watch' ), 'watch' ) . ''; + $watch .= ''; + $wgOut->addHtml( $watch ); + $wgOut->addHTML( " {$confirm} @@ -242,6 +253,15 @@ class MovePageForm { } else { $talkmoved = 'notalkpage'; } + + # Deal with watches + if( $this->watch ) { + $wgUser->addWatch( $ot ); + $wgUser->addWatch( $nt ); + } else { + $wgUser->removeWatch( $ot ); + $wgUser->removeWatch( $nt ); + } # Give back result to user. $titleObj = SpecialPage::getTitleFor( 'Movepage' ); diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index b2e24ca8fb..ded82fbdbe 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -882,7 +882,7 @@ class PreferencesForm { $wgOut->addHtml( '

' ); $wgOut->addHtml( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots', 'watchlisthideminor' ) ) ); - $wgOut->addHtml( $this->getToggles( array( 'watchdefault', 'watchcreations', 'watchdeletion' ) ) ); + $wgOut->addHtml( $this->getToggles( array( 'watchdefault', 'watchcreations', 'watchmoves', 'watchdeletion' ) ) ); $wgOut->addHtml( '' ); diff --git a/includes/User.php b/includes/User.php index 8f0ce2716b..e038066767 100644 --- a/includes/User.php +++ b/includes/User.php @@ -50,6 +50,7 @@ class User { 'editwidth', 'watchcreations', 'watchdefault', + 'watchmoves', 'watchdeletion', 'minordefault', 'previewontop', diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index ead8696784..ff1852d73a 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -466,6 +466,7 @@ parent class in order maintain consistency across languages. 'tog-editwidth' => 'Edit box has full width', 'tog-watchcreations' => 'Add pages I create to my watchlist', 'tog-watchdefault' => 'Add pages I edit to my watchlist', +'tog-watchmoves' => 'Add pages I move to my watchlist', 'tog-watchdeletion' => 'Add pages I delete to my watchlist', 'tog-minordefault' => 'Mark all edits minor by default', 'tog-previewontop' => 'Show preview before edit box', @@ -1953,6 +1954,7 @@ In those cases, you will have to move or merge the page manually if desired.', 'movenologintext' => "You must be a registered user and [[Special:Userlogin|logged in]] to move a page.", 'newtitle' => 'To new title', +'move-watch' => 'Watch this page', 'movepagebtn' => 'Move page', 'pagemovedsub' => 'Move succeeded', 'pagemovedtext' => "Page \"[[$1]]\" moved to \"[[$2]]\".", -- 2.20.1